
package upcoming.client.internal.xstream;

import com.thoughtworks.xstream.converters.SingleValueConverter;
import com.thoughtworks.xstream.converters.basic.BooleanConverter;
import com.thoughtworks.xstream.converters.basic.IntConverter;
import com.thoughtworks.xstream.converters.basic.StringConverter;
import com.thoughtworks.xstream.mapper.Mapper;
import com.thoughtworks.xstream.mapper.MapperWrapper;

public class UpcomingMapper extends MapperWrapper
{

	public UpcomingMapper(Mapper wrapped)
	{
		super(wrapped);
	}

    public SingleValueConverter getConverterFromAttribute(Class definedIn, String attribute, Class type)
    {
    	
    	SingleValueConverter converter = super.getConverterFromAttribute(definedIn, attribute, type);
    	
    	
    	if (converter == null)
    	{
    		
    		if (type == String.class)
    		{
    			converter = new StringConverter();
    		}
    		else if ( (type == Boolean.TYPE) || (type == Boolean.class) )
    		{
    			converter = new BooleanConverter();
    		}
    		else if (type == java.util.Calendar.class)
    		{
    			converter = new CalendarConverter();
    		}
    		else if ( (type == Integer.class) || (type == Integer.TYPE) )
     		{
    			converter = new IntConverter();
    		}
    	}
    	
    	return converter;
    }
	
}
